package com.woke.bean;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.woke.dao.WokeDao;
import com.sun.jmx.snmp.Timestamp;
import com.woke.dao.CjPrize;

public class CjPrizeBean {

	public static List getCjPrizeList() {
		String sql = "select * from cjprize order by id desc";
		return CjPrize.getData(sql);
	}

	

	
	public static void addcjprize(String cjid, String prizename,String probability,String rank) {
		String sql = "insert into cjprize(cjid,prizename,probability,rank) values('" + cjid + "','" + prizename + "','" + probability+ "','" + rank + "')";
		WokeDao.updateMySqlData(sql);
	}

	

	
	public static void deletecjprize(String id) {
		String sql = "delete from cjprize where id=" + id;
		WokeDao.updateMySqlData(sql);
	}

	
	public static void updatecjprize(String id,String cjid, String prizename,String probability,String rank) {
		String sql = "update cjprize set cjid='" + cjid + "',prizename='" + prizename
				+ "',probability='"+probability+"',rank='"+rank+"' where id=" + id;
		WokeDao.updateMySqlData(sql);
	}

	public static List selectUser(String username,String id) {
		String sql = "select * from user where 1=1";
		if (!username.equals("")) {
			sql += " and username like '%" + username + "%'";
		}
		if (!id.equals("")) {
			sql += " and id like '%" + id + "%'";
		}
		return CjPrize.getData(sql);
	}

	

}
